package com.dpj.util;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;

public class SharePrenceUtil {

	public static final String PRE_NAME = "dpj";
	public static final String EMAIL = "email";
	public static final String PWD = "pwd";
	
	public static String getEmail(Context context) {
		SharedPreferences spf = context.getSharedPreferences(PRE_NAME, Context.MODE_PRIVATE);
		return spf.getString(EMAIL, "");
	}
	
	public static String getPwd(Context context) {
		SharedPreferences spf = context.getSharedPreferences(PRE_NAME, Context.MODE_PRIVATE);
		return spf.getString(PWD, "");
	}
	
	public static void setEmail(Context context,String email) {
		SharedPreferences spf = context.getSharedPreferences(PRE_NAME, Context.MODE_PRIVATE);
		Editor editor = spf.edit();
		editor.putString(EMAIL, email);
		editor.commit();
	}
	
	public static void setPwd(Context context,String pwd) {
		SharedPreferences spf = context.getSharedPreferences(PRE_NAME, Context.MODE_PRIVATE);
		Editor editor = spf.edit();
		editor.putString(PWD, pwd);
		editor.commit();
	}
}
